export interface BatteryInfo {
  level: number;
  state: number;
  AbsoluteCapacity: number;
  AdapterDetails: AdapterDetails;
  AdapterID: number;
  AdapterPowerTier: number;
  AdapterVoltage: number;
  Current: number;
  Description: string;
  ErrorFlags: number;
  FamilyCode: number;
  IsWireless: boolean;
  PMUConfiguration: number;
  SharedSource: number;
  Source: number;
  Watts: number;
  AdapterInfo: number;
  Amperage: number;
  AppleRawAdapterDetails: AdapterDetails[];
  AppleRawBatteryVoltage: number;
  AppleRawCurrentCapacity: number;
  AppleRawExternalConnected: boolean;
  AppleRawMaxCapacity: number;
  AtCriticalLevel: boolean;
  AvgTimeToEmpty: number;
  BatteryCellDisconnectCount: number;
  BatteryData: BatteryData;
  AlgoChemID: number;
  AlgoTemperature: number;
  BatteryHealthMetric: number;
  CellCurrentAccumulator: number[];
  CellCurrentAccumulatorCount: number;
  CellVoltage: number[];
  CellWom: number[];
  ChargeAccum: number;
  ChemID: number;
  ChemicalWeightedRa: number;
  CycleCount: number;
  DOD0: number[];
  DODatEOC: number;
  DailyMaxSoc: number;
  DailyMinSoc: number;
  DateOfFirstUse: number;
  DesignCapacity: number;
  Dod0AtQualifiedQmax: number;
  DynamicSoc1Vcut: number;
  FccComp1: number;
  FccComp2: number;
  FilteredCurrent: number;
  FilteredCurrentRc3: number;
  FilteredCurrentRc4: number;
  Flags: number;
  GaugeFlagRaw: number;
  GaugeResetCounter: number;
  ISS: number;
  ITMiscStatus: number;
  LifetimeData: LifetimeData;
  AverageTemperature: number;
  CycleCountLastQmax: number;
  FlashEraseCounter: number;
  FlashFailureCounter: number;
  LTDataCorruptionOffset: number;
  LTOCVRestCounter: number;
  LTOCVRestCounterHsp: number;
  LTQmaxUpdateCounter: number;
  LTQmaxUpdateCounterHsp: number;
  LowVoltageResidencyCounters: ChargerStatus;
  MaximumChargeCurrent: number;
  MaximumDischargeCurrent: number;
  MaximumFCC: number;
  MaximumPackVoltage: number;
  MaximumQmax: number;
  MaximumTemperature: number;
  MinimumFCC: number;
  MinimumPackVoltage: number;
  MinimumQmax: number;
  MinimumTemperature: number;
  NCCMax: number;
  NCCMin: number;
  ResetCnt: number;
  SafetyFaultCounter: ChargerStatus;
  TemperatureSamples: number;
  TimeAtHighSoc: ChargerStatus;
  TotalOperatingTime: number;
  UpdateTime: number;
  ManufactureDate: number;
  MaxCapacity: number;
  MfgData: ChargerStatus;
  PMUConfigured: number;
  PackCurrentAccumulator: number;
  PackCurrentAccumulatorCount: number;
  PassedCharge: number;
  PresentDOD: number[];
  Qmax: number[];
  QmaxDisqualificationReason: number;
  Qstart: number;
  RSS: number;
  RSSFiltered: number;
  Ra00: number;
  Ra01: number;
  Ra02: number;
  Ra03: number;
  Ra04: number;
  Ra05: number;
  Ra06: number;
  Ra07: number;
  Ra08: number;
  Ra09: number;
  Ra10: number;
  Ra11: number;
  Ra12: number;
  Ra13: number;
  Ra14: number;
  RaTableRaw: ChargerStatus[];
  ResScale: number;
  ResetData: ChargerStatus;
  ResetDataComms: number;
  ResetDataFirmware: number;
  ResetDataHardware: number;
  ResetDataSoftware: number;
  ResetDataWatchDog: number;
  Serial: string;
  SimRate: number;
  Soc1Voltage: number;
  StateOfCharge: number;
  TrueRemainingCapacity: number;
  UUID: number;
  Voltage: number;
  WatchdogDebugDump: ChargerStatus;
  WeightedRa: number[];
  iMaxAndSocSmoothTable: ChargerStatus;
  BatteryInstalled: boolean;
  BatteryInvalidWakeSeconds: number;
  BestAdapterIndex: number;
  BootPathUpdated: number;
  BootVoltage: number;
  CarrierMode: CarrierMode;
  CarrierModeHighVoltage: number;
  CarrierModeLowVoltage: number;
  CarrierModeStatus: number;
  ChargerConfiguration: number;
  ChargerData: ChargerData;
  ChargerID: number;
  ChargerInhibitReason: number;
  ChargerResetCounter: number;
  ChargerStatus: ChargerStatus;
  ChargingCurrent: number;
  ChargingVoltage: number;
  NotChargingReason: number;
  SlowChargingReason: number;
  TimeChargingThermallyLimited: number;
  VacVoltageLimit: number;
  CurrentCapacity: number;
  DeadBatteryBootData: DeadBatteryBootData;
  ActivePayloads: number;
  GeneralPayload: DeadBatteryBootData;
  AdapterType: number;
  AverageBattSkinTemp: number;
  AverageBattVirtualTemp: number;
  CloakEntryCount: number;
  PrechargeCount: number;
  StartBatteryCapacity: number;
  StartBatteryVoltage: number;
  TimeOnCharger: number;
  VbusType: number;
  WirelessChargingMode: number;
  ExternalChargeCapable: boolean;
  ExternalConnected: boolean;
  FullPathUpdated: number;
  FullyCharged: boolean;
  GasGaugeFirmwareVersion: number;
  IOGeneralInterest: string;
  IOReportLegend: IOReportLegend[];
  IOReportChannelInfo: IOReportChannelInfo;
  IOReportChannelUnit: number;
  IOReportChannels: Array<Array<number | string>>;
  IOReportGroupName: string;
  IOReportLegendPublic: boolean;
  InductiveData: InductiveData;
  FirmwareMode: number;
  InstantAmperage: number;
  IsCharging: boolean;
  KioskMode: KioskMode;
  KioskModeFullChargeVoltage: number;
  KioskModeHighSocDays: number;
  KioskModeHighSocSeconds: number;
  KioskModeLastHighSocHours: number;
  KioskModeMode: number;
  LPEMData: LPEMData;
  Mode: number;
  SOCFThreshold: number;
  StatusFlags: number;
  Location: number;
  ManufacturerData: ChargerStatus;
  NominalChargeCapacity: number;
  PostChargeWaitSeconds: number;
  PostDischargeWaitSeconds: number;
  PowerTelemetryData: {[key: string]: number};
  AccumulatedAdapterEfficiencyLoss: number;
  AccumulatedBatteryDischarge: number;
  AccumulatedBatteryPower: number;
  AccumulatedSystemEnergyConsumed: number;
  AccumulatedSystemLoad: number;
  AccumulatedSystemPowerIn: number;
  AccumulatedWallEnergyEstimate: number;
  AdapterEfficiencyLoss: number;
  AdapterEfficiencyLossAccumulatorCount: number;
  BatteryDischargeAccumulatorCount: number;
  BatteryPower: number;
  BatteryPowerAccumulatorCount: number;
  PowerTelemetryErrorCount: number;
  SystemCurrentIn: number;
  SystemEnergyConsumed: number;
  SystemLoad: number;
  SystemLoadAccumulatorCount: number;
  SystemPowerIn: number;
  SystemPowerInAccumulatorCount: number;
  SystemVoltageIn: number;
  WallEnergyEstimate: number;
  Temperature: number;
  TimeRemaining: number;
  UserVisiblePathUpdated: number;
  VirtualTemperature: number;
  'built-in': boolean;
}

export interface AdapterDetails {
  AdapterID: number;
  AdapterPowerTier: number;
  AdapterVoltage: number;
  Current: number;
  Description?: string;
  ErrorFlags?: number;
  FamilyCode?: number;
  IsWireless: boolean;
  PMUConfiguration: number;
  SharedSource: number;
  Source: number;
  Watts: number;
}

export interface BatteryData {
  AlgoChemID: number;
  AlgoTemperature: number;
  BatteryHealthMetric: number;
  CellCurrentAccumulator: number[];
  CellCurrentAccumulatorCount: number;
  CellVoltage: number[];
  CellWom: number[];
  ChargeAccum: number;
  ChemID: number;
  ChemicalWeightedRa: number;
  CycleCount: number;
  DOD0: number[];
  DODatEOC: number;
  DailyMaxSoc: number;
  DailyMinSoc: number;
  DateOfFirstUse: number;
  DesignCapacity: number;
  Dod0AtQualifiedQmax: number;
  DynamicSoc1Vcut: number;
  FccComp1: number;
  FccComp2: number;
  FilteredCurrent: number;
  FilteredCurrentRc3: number;
  FilteredCurrentRc4: number;
  Flags: number;
  GaugeFlagRaw: number;
  GaugeResetCounter: number;
  ISS: number;
  ITMiscStatus: number;
  LifetimeData: LifetimeData;
  AverageTemperature: number;
  CycleCountLastQmax: number;
  FlashEraseCounter: number;
  FlashFailureCounter: number;
  LTDataCorruptionOffset: number;
  LTOCVRestCounter: number;
  LTOCVRestCounterHsp: number;
  LTQmaxUpdateCounter: number;
  LTQmaxUpdateCounterHsp: number;
  LowVoltageResidencyCounters: ChargerStatus;
  MaximumChargeCurrent: number;
  MaximumDischargeCurrent: number;
  MaximumFCC: number;
  MaximumPackVoltage: number;
  MaximumQmax: number;
  MaximumTemperature: number;
  MinimumFCC: number;
  MinimumPackVoltage: number;
  MinimumQmax: number;
  MinimumTemperature: number;
  NCCMax: number;
  NCCMin: number;
  ResetCnt: number;
  SafetyFaultCounter: ChargerStatus;
  TemperatureSamples: number;
  TimeAtHighSoc: ChargerStatus;
  TotalOperatingTime: number;
  UpdateTime: number;
  ManufactureDate: number;
  MaxCapacity: number;
  MfgData: ChargerStatus;
  PMUConfigured: number;
  PackCurrentAccumulator: number;
  PackCurrentAccumulatorCount: number;
  PassedCharge: number;
  PresentDOD: number[];
  Qmax: number[];
  QmaxDisqualificationReason: number;
  Qstart: number;
  RSS: number;
  RSSFiltered: number;
  Ra00: number;
  Ra01: number;
  Ra02: number;
  Ra03: number;
  Ra04: number;
  Ra05: number;
  Ra06: number;
  Ra07: number;
  Ra08: number;
  Ra09: number;
  Ra10: number;
  Ra11: number;
  Ra12: number;
  Ra13: number;
  Ra14: number;
  RaTableRaw: ChargerStatus[];
  ResScale: number;
  ResetData: ChargerStatus;
  ResetDataComms: number;
  ResetDataFirmware: number;
  ResetDataHardware: number;
  ResetDataSoftware: number;
  ResetDataWatchDog: number;
  Serial: string;
  SimRate: number;
  Soc1Voltage: number;
  StateOfCharge: number;
  TrueRemainingCapacity: number;
  UUID: number;
  Voltage: number;
  WatchdogDebugDump: ChargerStatus;
  WeightedRa: number[];
  iMaxAndSocSmoothTable: ChargerStatus;
}

export interface LifetimeData {
  AverageTemperature: number;
  CycleCountLastQmax: number;
  FlashEraseCounter: number;
  FlashFailureCounter: number;
  LTDataCorruptionOffset: number;
  LTOCVRestCounter: number;
  LTOCVRestCounterHsp: number;
  LTQmaxUpdateCounter: number;
  LTQmaxUpdateCounterHsp: number;
  LowVoltageResidencyCounters: ChargerStatus;
  MaximumChargeCurrent: number;
  MaximumDischargeCurrent: number;
  MaximumFCC: number;
  MaximumPackVoltage: number;
  MaximumQmax: number;
  MaximumTemperature: number;
  MinimumFCC: number;
  MinimumPackVoltage: number;
  MinimumQmax: number;
  MinimumTemperature: number;
  NCCMax: number;
  NCCMin: number;
  ResetCnt: number;
  SafetyFaultCounter: ChargerStatus;
  TemperatureSamples: number;
  TimeAtHighSoc: ChargerStatus;
  TotalOperatingTime: number;
  UpdateTime: number;
}

export interface ChargerStatus {
  type: Type;
  data: number[];
}

export enum Type {
  Buffer = 'Buffer',
}

export interface CarrierMode {
  CarrierModeHighVoltage: number;
  CarrierModeLowVoltage: number;
  CarrierModeStatus: number;
}

export interface ChargerData {
  ChargerID: number;
  ChargerInhibitReason: number;
  ChargerResetCounter: number;
  ChargerStatus: ChargerStatus;
  ChargingCurrent: number;
  ChargingVoltage: number;
  NotChargingReason: number;
  SlowChargingReason: number;
  TimeChargingThermallyLimited: number;
  VacVoltageLimit: number;
}

export interface DeadBatteryBootData {
  ActivePayloads?: number;
  GeneralPayload?: DeadBatteryBootData;
  AdapterType: number;
  AverageBattSkinTemp: number;
  AverageBattVirtualTemp: number;
  CloakEntryCount: number;
  PrechargeCount: number;
  StartBatteryCapacity: number;
  StartBatteryVoltage: number;
  TimeOnCharger: number;
  VbusType: number;
  WirelessChargingMode: number;
}

export interface IOReportChannelInfo {
  IOReportChannelUnit: number;
}

export interface IOReportLegend {
  IOReportChannelInfo: IOReportChannelInfo;
  IOReportChannelUnit: number;
  IOReportChannels: Array<Array<number | string>>;
  IOReportGroupName: string;
}

export interface InductiveData {
  FirmwareMode: number;
}

export interface KioskMode {
  KioskModeFullChargeVoltage: number;
  KioskModeHighSocDays: number;
  KioskModeHighSocSeconds: number;
  KioskModeLastHighSocHours: number;
  KioskModeMode: number;
}

export interface LPEMData {
  CurrentCapacity: number;
  MaxCapacity: number;
  Mode: number;
  SOCFThreshold: number;
  StateOfCharge: number;
  StatusFlags: number;
}
